import request from './request'

// 发表评价
export function createComment(data) {
  return request.post('/comments', data)
}

// 删除评价
export function deleteComment(id) {
  return request.delete(`/comments/${id}`)
}

// 查询活动评价列表
export function getActivityComments(params) {
  console.log(params)
  return request.get(`/comments/activity/${params.activityId}`, {
    params: {
      current: params.pageNum || 1,
      size: params.pageSize || 10
    }
  })
}

// 获取平均评分
export function getAverageScore(activityId) {
  return request.get(`/comments/activity/${activityId}/average-score`)
}

// 获取活动评分（别名函数，与getAverageScore功能相同）
export function getActivityScore(activityId) {
  return getAverageScore(activityId)
}

// 获取评价数量
export function getCommentCount(activityId) {
  return request.get(`/comments/activity/${activityId}/count`)
}

// 检查是否已评价
export function checkUserComment(activityId) {
  return request.get(`/comments/check/${activityId}`)
}